{% macro login_provider_input(login_provider) %}
    <input
      name="{{login_provider.name}}"
      type="image"
      class="{{login_provider.type}}"
      src="{{login_provider.icon_media_path|media}}"
      alt="{{login_provider.tooltip_text}}"
      title="{{login_provider.tooltip_text}}"
    />
{% endmacro %}
{% macro login_provider_input_large(login_provider) %}
    <input
      name="{{login_provider.name}}"
      type="image"
      class="{{login_provider.type}}"
      src="{{ "images/%s.png"|format(login_provider.name)|media }}"
      alt="{{login_provider.tooltip_text}}"
      title="{{login_provider.tooltip_text}}"
      height="35"
      width="35"
    />
{% endmacro %}
{% macro provider_buttons(
                    login_form = None,
                    major_login_providers = None,
                    minor_login_providers = None,
                    hide_local_login = False,
                    settings = None,
                    logged_in = False,
                    show_buttons = True
                )
%}
    {% if show_buttons == True %}{# a hack #}
        <div id="login-icons">
            {% if major_login_providers %}
            <div class="login-icons large">
                {% for login_provider in major_login_providers %}
                    {% if login_provider.name == 'local' and hide_local_login == True %}
                        {# do nothing here, left if statement this way for simplicity #}
                    {% else %}
                        {% if logged_in == True and login_provider.type == 'password' 
                            and login_provider.password_changeable == False 
                        %}
                        {% else %}
                        <div class="large-login-icon" style="margin-right: -48%">
                            <table width="100%">
                                <tr>
                                    <td style="padding-right: 0.5em; width: 3.2em">
                                        {{ login_provider_input_large(login_provider) }}
                                    </td>
                                    <td>
                                        <font class="provider-desktop">Login using </font>{{login_provider.name}}
                                    </td>
                                </tr>
                            </table>
                        </div>
                        {% endif %}
                    {% endif %}
                {% endfor %}
            </div>
            {% endif %}
            {% if minor_login_providers %}
            <ul class="login-icons small">
                {% for login_provider in minor_login_providers %}
                    {% if logged_in == True and login_provider.type == 'password' 
                        and login_provider.password_changeable == False
                    %}
                    {% else %}
                    <li>
                        {{ login_provider_input(login_provider) }}
                    </li>
                    {% endif %}
                {% endfor %}
            </ul>
            {% endif %}
        </div>
        <div style="width: 100%">
            <fieldset 
                id="openid-fs" 
                {% if not login_form.openid_login_token.errors %}
                    style="display:none;"
                {% endif %}
            >
                <h2 id="openid-heading" style="margin-bottom: 0;">{% trans %}Please enter your <span>user name</span>, then sign in{% endtrans %}</h2>
                <p class="hint" style="margin-bottom: 1em">{% trans %}(or select another login method above){% endtrans %}</p>
                <div class="openid-pane" id="openid-pane-large">
                    <table style="width: 100%">
                        <tr>
                            <td style="padding-bottom: 0.5em">
                                <input id="openid_login_text" type="text" name="openid_login_token"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input id="openid-btn" class="normal-btn" type="submit" name="openid_login_with_extra_token" value="{% trans %}Sign in{% endtrans %}"/>
                            </td>
                        </tr>
                    </table>
                </div>
            </fieldset> 
        </div>
    {% endif %}
{% endmacro %}
